Answer:

  1. Translation (into machine instructions, which are then executed by the processor)
  2. Interpretation (by an interpreter program)

Bytecodes

Java combines these ideas in a way that will take some explaining. To get a Java source program running, it first is translated into bytecodes.

A Java bytecode is a machine instruction for a Java processor. The architecture of this processor has been described by the designers of Java and is available to anyone.

To run a Java program on a Java processor, the source program (the text file) must be translated into bytecodes. Here is a picture of the sample Java program Hello.java being translated into bytecodes. The file of bytecodes (machine language for the Java processor) is called Hello.class.

In this picture, the source program Hello.java is examined by a program called javac running on your computer. The javac program is a compiler (a translator) that translates the source program into a bytecode file called Hello.class.

Important Idea: The bytecode file will contain exactly the same bytecodes no matter what computer system is used.

The Java compiler on a Macintosh will produce the exact same bytecodes as the Java compiler on an Intel system.

QUESTION 9:

If you had a hardware Java processor could it run the bytecodes as a program?